package xiegd.study.lambda;

import lombok.Builder;
import lombok.Data;
import lombok.ToString;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description:
 * @Author: xieguangda
 * @Date: 2021年06月25日 10:34
 */
public class LambdaSordStudy {

    public static void main(String[] args) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        List<SordBean> beans = new ArrayList<SordBean>();
        beans.add(SordBean.builder().age(10).workTime(format.parse("2020-09-11")).build());
        beans.add(SordBean.builder().age(13).workTime(format.parse("2020-09-13")).build());
        beans.add(SordBean.builder().age(10).workTime(format.parse("2020-09-01")).build());

        beans.add(SordBean.builder().age(10).build());
        beans.add(SordBean.builder().age(9).build());
        beans.add(SordBean.builder().age(15).build());
       // beans.stream().sorted(Comparator.comparing(bean::getId).thenComparing(Student::getScore))
        beans = beans.stream().sorted(Comparator.comparing(SordBean::getAge).thenComparing(SordBean::getWorkTime)).collect(Collectors.toList());
        System.out.println("beans:" + beans);

        System.out.println("88888888");
       // localDate.
    }
}

@Data
@Builder
@ToString
class SordBean{
    private int age;
    private Date workTime;
}
